﻿using Lhz.Common.Business;
using Lhz.Sc.Entity.Database;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Lhz.Sc.Business
{
    public class ApplicationProxy : EntityProxy<Guid, Application>
    {
        public ApplicationProxy(string pathConfiguration = null) : base(pathConfiguration)
        {

        }

        public Application QueryByNo(string no)
        {
            return CreateQueryable().QueryByNo(no).FirstOrDefault();
        }

        public List<Guid> DeleteCheck(IEnumerable<Guid> pks)
        {
            var result = new List<Guid>();
            foreach (var pk in pks)
            {
                if (new ServiceProxy().AnyByApplicationGuid(pk))
                {
                    result.Add(pk);
                }
            }
            return result;
        }
    }
}
